 import confing from '../config/index.js'
 import NodeRSA from 'node-rsa'
// const confing =require('../config/index.js') 
// const NodeRSA =require('node-rsa')
class lib {
  constructor() {
     this.rsa_private_key= confing.rsa_private_key
   //  this.key= new NodeRSA(this.rsa_private_key)
   //var publicPem = this.key.exportKey('-public-pem')
   // var privatePem = key.exportKey(pkcsType + '-private-pem');
  }
  // 前端：使用私钥进行加密.setOptions({ encryptionScheme: 'pkcs8' })
   encrypt (text) {
     return (new NodeRSA(this.rsa_private_key)).encryptPrivate(text,'base64')
   }
  // 前端：使用私钥解密后端发来的json数据
   privateDecrypted (text) {
     return (new NodeRSA(this.rsa_private_key)).decrypt(text, 'utf8')
   }
   back(_){
     _.$router.go()
   }
}
 
 export default new lib();
